/*********************************************************************************
 *      Copyright:  (C) 2022 Zhang Changxing<ZhangChangxingVIP@163.com>
 *                  All rights reserved.
 *
 *       Filename:  sms_pdu.h
 *    Description:  This file is used for function declarations.
 *                 
 *        Version:  1.0.0(05/1/2022)
 *         Author:  Zhang Changxing <ZhangChangxingVIP@163.com>
 *      ChangeLog:  1, Release initial version on "05/1/2022  01:33:25 AM"
 *                 
 ********************************************************************************/


#ifndef _SMS_PDU_H_
#define _SMS_PDU_H_

#include "main.h"
#include "logger.h"


/*--------------------------------------------------------------
 *   description:   Get and process the center number
 *          args:   $center_buf:    Receive the processed center number
 *  return value:   <0: failure,    =0:ok 
 *--------------------------------------------------------------*/
int processing_center_number(char *center_buf);


/*--------------------------------------------------------------
 *   description:   Get and process the target number
 *          args:   $center_buf:    Receive the processed center number
 *  return value:   <0: failure,    =0:ok 
 *--------------------------------------------------------------*/
int processing_phone_number(char *phone_buf);


/*--------------------------------------------------------------
 *   description:   Convert UTF8 encoding format to Unicode encoding format
 *          args:   $utf8_buf:      UTF8 Encoding format string
 *                  $unicode_buf    Stores the address of the Unicde coding buffer
 *                  $len            Unicde Indicates the encoded byte length
 *  return value:   <0: failure,    =0:ok 
 *--------------------------------------------------------------*/
int utf8_to_unicode(char *utf8_buf, char *unicode_buf, int *len);


/*--------------------------------------------------------------
 *   description:   Byte stream character stream
 *          args:   $src_buf:       Byte stream buffer address
 *                  $dest_buf:      Character stream buffer address
 *                  $source_len:    Byte stream buffer length
 *  return value:   <0: failure,    =0:ok 
 *--------------------------------------------------------------*/
int hex_to_str(char *dest_buf, char *src_buf, int src_len);


/*--------------------------------------------------------------
 *   description:   The center number, destination number, and 
                    short message are packaged into a PDU package
 *          args:   $center_buf:    Address of the center number 
                    buffer that has been processed
 *                  $phone_buf:     Target number buffer address 
                    already processed
 *                  $sms_buf:       Address of the processed SMS buffer
 *                  $pdu_buf:       Address of the packed PDU buffer
 *                  $cmgs_length    The sum of the length of the target 
 *                  number and the data section
 *  return value:   <0: failure,    =0:ok 
 *--------------------------------------------------------------*/
int pdu_packet(char *center_buf, char *phone_buf, char *sms_buf, char *pdu_buf, int *cmgs_length);

#endif